package com.heima.file.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 */
@Data
@Configuration
@EnableConfigurationProperties({MinIoProperties.class})
public class MinIoAutoConfiguration {
    @Autowired
    private MinIoProperties minIoProperties;

    @Bean
    public MinioClient buildMinioClient(){
        return MinioClient.builder().credentials(minIoProperties.getAccessKey(),
                minIoProperties.getSecretKey())
                .endpoint(minIoProperties.getEnfpoint())
                .build();
    }

}
